#! /usr/bin/env perl
# author: maxiao
# date: 2023-03-07 22:48
# description: 实现数组求和

use v5.20;
use utf8;

my @fred = qw( 1 3 5 7 9 );

my $fred_total = total(@fred);
my $user_total = total(<STDIN>);
total(1..1000);

sub total {
    my $sum = 0;
    foreach ( @_ ){
        $sum += $_;
    }
    print "sum ---> $sum\n";
}
